Use treesit-node-match-p in treesit-parent-while
authorYuan Fu <casouri@gmail.com>
Tue, 6 Feb 2024 07:12:36 +0000 (23:12 -0800)
committerYuan Fu <casouri@gmail.com>
Tue, 6 Feb 2024 07:15:26 +0000 (23:15 -0800)
The previous commit should've done this, but I missed it.

* lisp/treesit.el (treesit-parent-while): Use treesit-node-match-p.

lisp/treesit.el

index f179204d89c0b8051c429c09481e0d561381bd6f..6a485ae591ab8e6b7d8510f630ae005b936f1537 100644 (file)
@@ -366,7 +366,7 @@ returns nil.
 PRED can be a predicate function, a regexp matching node type,
 and more; see docstring of `treesit-thing-settings'."
   (let ((last nil))
-    (while (and node (funcall pred node))
+    (while (and node (treesit-node-match-p node pred))
       (setq last node
             node (treesit-node-parent node)))
     last))